home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pangomm-1.4 / pangomm / context.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-20  |  12.1 KB  |  350 lines

  1. // -*- c++ -*-
  2. // Generated by gtkmmproc -- DO NOT MODIFY!
  3. #ifndef _PANGOMM_CONTEXT_H
  4. #define _PANGOMM_CONTEXT_H
  5.  
  6. #include <glibmm.h>
  7.  
  8. /* $Id: context.hg,v 1.5 2004/12/01 11:46:29 murrayc Exp $ */
  9.  
  10. /* context.h
  11.  * 
  12.  * Copyright (C) 1998-1999 The gtkmm Development Team 
  13.  *
  14.  * This library is free software; you can redistribute it and/or
  15.  * modify it under the terms of the GNU Library General Public
  16.  * License as published by the Free Software Foundation; either
  17.  * version 2 of the License, or (at your option) any later version.
  18.  *
  19.  * This library is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  22.  * Library General Public License for more details.
  23.  *
  24.  * You should have received a copy of the GNU Library General Public
  25.  * License along with this library; if not, write to the Free
  26.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27.  */
  28.  
  29.  
  30. #include <glibmm/object.h>
  31. #include <glibmm/arrayhandle.h>
  32. #include <glibmm/listhandle.h>
  33. #include <pangomm/fontdescription.h>
  34. #include <pangomm/fontmetrics.h>
  35. #include <pangomm/fontset.h>
  36. #include <pangomm/fontmap.h>
  37. #include <pangomm/item.h>
  38. #include <pangomm/attrlist.h>
  39. #include <pangomm/types.h> //For Matrix
  40. #include <pango/pango-context.h>
  41.  
  42.  
  43. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  44. typedef struct _PangoContext PangoContext;
  45. typedef struct _PangoContextClass PangoContextClass;
  46. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  47.  
  48.  
  49. namespace Pango
  50. { class Context_Class; } // namespace Pango
  51. namespace Pango
  52. {
  53.  
  54.  
  55. /** @addtogroup pangommEnums Enums and Flags */
  56.  
  57. /**
  58.  * @ingroup pangommEnums
  59.  */
  60. enum Direction
  61. {
  62.   DIRECTION_LTR,
  63.   DIRECTION_RTL,
  64.   DIRECTION_TTB_LTR,
  65.   DIRECTION_TTB_RTL,
  66.   DIRECTION_WEAK_LTR,
  67.   DIRECTION_WEAK_RTL,
  68.   DIRECTION_NEUTRAL
  69. };
  70.  
  71. } // namespace Pango
  72.  
  73.  
  74. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  75. namespace Glib
  76. {
  77.  
  78. template <>
  79. class Value<Pango::Direction> : public Glib::Value_Enum<Pango::Direction>
  80. {
  81. public:
  82.   static GType value_type() G_GNUC_CONST;
  83. };
  84.  
  85. } // namespace Glib
  86. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  87.  
  88.  
  89. namespace Pango
  90. {
  91.  
  92.  
  93. /** A Pango::Context stores global information used to control the itemization process.
  94.  * You can retrieve a Pango::Context object with Gtk::Widget::create_pango_context() or
  95.  * Gtk::Widget::get_pango_context(). If you don't use gtkmm call some c function of the
  96.  * pango backend you intend to use and create a wrapper for the returned context,
  97.  * e.g. Glib::wrap(pango_x_get_context()).
  98.  *
  99.  * Creating a Pango::Context object is the starting point of every rendering process.
  100.  * You can either use it to create a high level Pango::Layout object which does all
  101.  * the hard work for you by passing it into
  102.  * Pango::Layout::create() or to generate glyph strings from character strings with
  103.  * the help of itemize() and Pango::Item::shape() subsequently.
  104.  *
  105.  * Which fonts are used for rendering can be influenced by setting the default
  106.  * font description, language and base direction of the context.
  107.  *
  108.  * If you want to calculate the space some text will need to be displayed you
  109.  * might find the functions of Pango::FontMetrics useful. Use get_metrics() to
  110.  * obtain the Pango::FontMetrics object for a specific Pango::FontDescription.
  111.  * For more detailed calculations in a rendering-system-independant manner
  112.  * and to determine whether specific characters can be represented by the
  113.  * font that would be used for a specific Pango::FontDescription load a
  114.  * Pango::Fontset with load_fontset() (load_font() returns the Pango::Font
  115.  * that is the closest match for a Pango::FontDescription; however that's not
  116.  * necessarily the font that will be used for rendering).
  117.  */
  118.  
  119. class Context : public Glib::Object
  120. {
  121.    
  122. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  123.  
  124. public:
  125.   typedef Context CppObjectType;
  126.   typedef Context_Class CppClassType;
  127.   typedef PangoContext BaseObjectType;
  128.   typedef PangoContextClass BaseClassType;
  129.  
  130. private:  friend class Context_Class;
  131.   static CppClassType context_class_;
  132.  
  133. private:
  134.   // noncopyable
  135.   Context(const Context&);
  136.   Context& operator=(const Context&);
  137.  
  138. protected:
  139.   explicit Context(const Glib::ConstructParams& construct_params);
  140.   explicit Context(PangoContext* castitem);
  141.  
  142. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  143.  
  144. public:
  145.   virtual ~Context();
  146.  
  147. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  148.   static GType get_type()      G_GNUC_CONST;
  149.   static GType get_base_type() G_GNUC_CONST;
  150. #endif
  151.  
  152.   ///Provides access to the underlying C GObject.
  153.   PangoContext*       gobj()       { return reinterpret_cast<PangoContext*>(gobject_); }
  154.  
  155.   ///Provides access to the underlying C GObject.
  156.   const PangoContext* gobj() const { return reinterpret_cast<PangoContext*>(gobject_); }
  157.  
  158.   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  159.   PangoContext* gobj_copy();
  160.  
  161. private:
  162.  
  163.     //PANGO_ENABLE_BACKEND
  164.    
  165. protected:
  166.   Context();
  167.   
  168. public:
  169.   /** List all available font families for a context.
  170.    * You can specify one of these as your desired font family in the Pango::FontDesciption
  171.    * objects you use, e.g. in the default font description of the context.
  172.    * @return An array of Pango::FontFamily objects.
  173.    */
  174.   Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const;
  175.   
  176.   
  177.   /** Gets the Pango::Fontmap used to look up fonts for this context.
  178.    * @return The font map for the Pango::Context. This value
  179.    * is owned by Pango and should not be unreferenced.
  180.    * 
  181.    * Since: 1.6.
  182.    */
  183.   Glib::RefPtr<FontMap> get_font_map();
  184.   
  185.   /** Gets the Pango::Fontmap used to look up fonts for this context.
  186.    * @return The font map for the Pango::Context. This value
  187.    * is owned by Pango and should not be unreferenced.
  188.    * 
  189.    * Since: 1.6.
  190.    */
  191.   Glib::RefPtr<const FontMap> get_font_map() const;  
  192.  
  193.   
  194.   /** Loads the font in one of the fontmaps in the context
  195.    * that is the closest match for @a desc .
  196.    * @param desc A Pango::FontDescription describing the font to load.
  197.    * @return The font loaded, or <tt>0</tt> if no font matched.
  198.    */
  199.   Glib::RefPtr<Font> load_font(const FontDescription& desc) const;
  200.   
  201.   /** Load a set of fonts in the context that can be used to render
  202.    * a font matching @a desc .
  203.    * @param desc A Pango::FontDescription describing the fonts to load.
  204.    * @param language A Pango::Language the fonts will be used for.
  205.    * @return The fontset, or <tt>0</tt> if no font matched.
  206.    */
  207.   Glib::RefPtr<Fontset> load_fontset(const FontDescription& desc, const Language& language) const;
  208.  
  209.   /** Get overall metric information for a particular font description.
  210.    * The metrics may be substantially different for different scripts. However this
  211.    * function overload returns the metrics of the entire font.
  212.    * @param desc A Pango::FontDescription object.
  213.    * @return A Pango::FontMetrics object.
  214.    */
  215.   FontMetrics get_metrics(const FontDescription& desc) const;
  216.   
  217.   /** Get overall metric information for a font particular font
  218.    * description.  Since the metrics may be substantially different for
  219.    * different scripts, a language tag can be provided to indicate that
  220.    * the metrics should be retrieved that correspond to the script(s)
  221.    * used by that language.
  222.    * 
  223.    * The Pango::FontDescription is interpreted in the same way as
  224.    * by pango_itemize(), and the family name may be a comma separated
  225.    * list of figures. If characters from multiple of these families
  226.    * would be used to render the string, then the returned fonts would
  227.    * be a composite of the metrics for the fonts loaded for the
  228.    * individual families.
  229.    * @param desc A Pango::FontDescription structure.
  230.    * @param language Language tag used to determine which script to get the metrics
  231.    * for.
  232.    * @return A Pango::Metrics object.
  233.    */
  234.   FontMetrics get_metrics(const FontDescription& desc, const Language& language) const;
  235.   
  236.   /** Set the default font description for the context
  237.    * @param desc The new pango font description.
  238.    */
  239.   void set_font_description(const FontDescription& desc);
  240.   
  241.   /** Retrieve the default font description for the context.
  242.    * @return A pointer to the context's default font description.
  243.    * This value must not be modified or freed.
  244.    */
  245.   FontDescription get_font_description() const;
  246.   
  247.   /** Retrieves the global language tag for the context.
  248.    * @return The global language tag.
  249.    */
  250.   Language get_language() const;
  251.   
  252.   /** Sets the global language tag for the context.
  253.    * @param language The new language tag.
  254.    */
  255.   void set_language(const Language& language);
  256.   
  257.   /** Sets the base direction for the context.
  258.    * 
  259.    * The base direction is used in applying the Unicode bidirectional
  260.    * algorithm; if the @a direction  is Pango::DIRECTION_LTR or
  261.    * Pango::DIRECTION_RTL, then the value will be used as the paragraph
  262.    * direction in the Unicode bidirectional algorithm.  A value of
  263.    * Pango::DIRECTION_WEAK_LTR or Pango::DIRECTION_WEAK_RTL is used only
  264.    * for paragraphs that do not contain any strong characters themselves.
  265.    * @param direction The new base direction.
  266.    */
  267.   void set_base_dir(Direction direction);
  268.   
  269.   /** Retrieves the base direction for the context. See
  270.    * pango_context_set_base_dir().
  271.    * @return The base direction for the context.
  272.    */
  273.   Direction get_base_dir() const;
  274.  
  275.   
  276.   /** Sets the transformation matrix that will be applied when rendering
  277.    * with this context. Note that reported metrics are in the user space
  278.    * coordinates before the application of the matrix, not device-space
  279.    * coordiantes after the application of the matrix. So, they don't scale
  280.    * with the matrix, though they may change slightly for different
  281.    * matrices, depending on how the text is fit to the pixel grid.
  282.    * 
  283.    * Since: 1.6
  284.    * @param matrix A Pango::Matrix, or <tt>0</tt> to unset any existing matrix.
  285.    * (No matrix set is the same as setting the identity matrix.).
  286.    */
  287.   void set_matrix(const Matrix& matrix);
  288.   //TODO: _WRAP_METHOD(Matrix get_matrix() const, pango_context_get_matrix)
  289.  
  290.   /** Breaks a piece of text into segments with consistent directional level and shaping engine.
  291.    * Each byte of @a text will be contained in exactly one of the items in the returned list.
  292.    * The generated list of items will be in logical order (the start offsets of the items
  293.    * are ascending).
  294.    * @param text The text to itemize.
  295.    * @param attrs The set of attributes that apply.
  296.    * @return A list of Pango::Item objects.
  297.    */
  298.   ListHandle_Item itemize(const Glib::ustring& text, const AttrList& attrs) const;
  299.  
  300.   /** Breaks a piece of text into segments with consistent directional level and shaping engine.
  301.    * Each byte of @a text will be contained in exactly one of the items in the returned list. 
  302.    * The generated list of items will be in logical order (the start offsets of the items
  303.    * are ascending).
  304.    *
  305.    * @a cached_iter should be an iterator over @a attrs currently positioned at a range before
  306.    * or containing @a start_index. @a cached_iter will be advanced to the range covering the
  307.    * position just after @a start_index + @a length. (i.e. if itemizing in a loop, just keep
  308.    * passing in the same @a cached_iter).
  309.    *
  310.    * @param text The text to itemize.
  311.    * @param start_index First byte in @a text to process.
  312.    * @param length The number of bytes (not characters) to process after @a start_index. This must be >= <tt>0</tt>.
  313.    * @param attrs The set of attributes that apply to @a text.
  314.    * @param cached_iter Cached attribute iterator.
  315.    * @return A list of Pango::Item structures.
  316.    */
  317.   ListHandle_Item itemize(const Glib::ustring& text, int start_index, int length,
  318.                           const AttrList& attrs, AttrIter& cached_iter) const;
  319.  
  320.  
  321. public:
  322.  
  323. public:
  324.   //C++ methods used to invoke GTK+ virtual functions:
  325.  
  326. protected:
  327.   //GTK+ Virtual Functions (override these to change behaviour):
  328.  
  329.   //Default Signal Handlers::
  330.  
  331.  
  332. };
  333.  
  334. } /* namespace Pango */
  335.  
  336.  
  337. namespace Glib
  338. {
  339.   /** @relates Pango::Context
  340.    * @param object The C instance
  341.    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
  342.    * @result A C++ instance that wraps this C instance.
  343.    */
  344.   Glib::RefPtr<Pango::Context> wrap(PangoContext* object, bool take_copy = false);
  345. }
  346.  
  347.  
  348. #endif /* _PANGOMM_CONTEXT_H */
  349.  
  350.